package org.fluidripple.socket.session;

import io.netty.channel.Channel;
import lombok.Data;
import org.fluidripple.socket.protocol.Protocol;

import java.net.InetSocketAddress;
import java.util.*;

@Data
public class Session {

    //设备编号
    private String deviceSerializable;
    //当前channel
    private Channel channel;
    //连接时间
    private Date connectTime;
    //sessionid
    private String sessionId= UUID.randomUUID().toString();
    //客户端地址
    private InetSocketAddress remoteAddress;
    //客户端地址-->ip
    private String remoteAddressStr;
    //对应的协议处理器
    private Protocol protocol;
    //是否开始采集数据
    private boolean collectData;
    //放大倍数
    private Magnification magnification;
    //采样频率
    private Integer samplingFrequency;

    public Session(Channel channel, InetSocketAddress remoteAddress) {
        this.channel = channel;
        this.connectTime = new Date();
        this.remoteAddress = remoteAddress;
        this.remoteAddressStr=remoteAddress.getHostString();
    }
}
